package com.xuecheng.manage_cms.service;

import com.xuecheng.framework.domain.system.SysDictionary;
import com.xuecheng.framework.domain.system.SysDictionaryValue;
import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.QueryResult;
import com.xuecheng.manage_cms.dao.SysDictionaryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SystemService {

    @Autowired
    private SysDictionaryRepository sysDictionaryRepository;

    //根据数据字典查询内容
    public QueryResponseResult findDataByType(String type){
        SysDictionary dictionary = sysDictionaryRepository.findBydType(type);
        List<SysDictionaryValue> dValue = dictionary.getDValue();
        QueryResult queryResult = new QueryResult();
        queryResult.setList(dValue);
        return new QueryResponseResult(CommonCode.SUCCESS,queryResult);
    }
}
